package com.chatTools.server.service;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

/**
 * @author： pang-yun
 * @date： 2021-09-16 15:56
 * 功能目的 ：用于
 */

public class UserServiceMemoryImpl implements IUserService {

    private Map<String, String> allUserMap = new ConcurrentHashMap<>();

    {
        allUserMap.put("pang", "1234");
        allUserMap.put("chao", "1234");
        allUserMap.put("jie", "1234");
        allUserMap.put("user", "1234");
        allUserMap.put("root", "1234");
    }

    @Override
    public boolean login(String username, String password) {
        String pass = allUserMap.get(username);
        if (pass == null) {
            return false;
        }
        return pass.equals(password);
    }
}
